import pymysql


class JIM():
    def __init__(self, host, port, user, password, database, charset='utf8'):
        self.host = host
        self.port = port
        self.user = user
        self.password = password
        self.database = database
        self.charset = charset

    def one(self,mysql_name1, mysql_name2, mysql_name3, mysql_name4, mysql_name5):
        self.conn = pymysql.connect(host=self.host, port=self.port, user=self.user, password=self.password,
                                    database=self.database, charset=self.charset)
        self.cursor = self.conn.cursor()
        self.sql = 'insert into det_overseas_combine({},{},{},{},{}) values(%s, %s, %s, %s, %s)'.format(mysql_name1, mysql_name2, mysql_name3, mysql_name4, mysql_name5)

        self.cursor.execute(self.sql, (
        product_sku1, product_title1, sub_product_sku2, sub_product_sku_num.replace(' ', ''), product_title2))

        self.conn.commit()
